package com.synergy.stockflow.procure.service.impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.Date;
import java.util.List;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.synergy.stockflow.procure.mapper.PurchaseOrderMapper;
import com.synergy.stockflow.procure.entity.PurchaseOrder;
import com.synergy.stockflow.procure.service.PurchaseOrderService;
@Service
public class PurchaseOrderServiceImpl extends ServiceImpl<PurchaseOrderMapper, PurchaseOrder> implements PurchaseOrderService{

    @Override
    public Page<PurchaseOrder> selectAll(Page<PurchaseOrder> page,
                                         String purchaseOrderId,
                                         String purchaseOrderName,
                                         String purchaseOrderProductionPlanningId,
                                         Date purchaseOrderDateOfSigning,
                                         Date purchaseOrderDeliveryDate,
                                         String purchaseOrderEmployeeId,
                                         String purchaseOrderVendorId,
                                         String purchaseOrderInboundWarehouse,
                                         String purchaseOrderState) {
        List<PurchaseOrder> purchaseOrders = baseMapper.selectAll(page,
                purchaseOrderId,
                purchaseOrderName,
                purchaseOrderProductionPlanningId,
                purchaseOrderDateOfSigning,
                purchaseOrderDeliveryDate,
                purchaseOrderEmployeeId,
                purchaseOrderVendorId,
                purchaseOrderInboundWarehouse,
                purchaseOrderState);
        page.setRecords(purchaseOrders);
        return page;
    }

    @Override
    public int deleteIs(String purchaseOrderId) {
        baseMapper.deleteIs(purchaseOrderId);
        return 0;
    }

    @Override
    public PurchaseOrder selectDetails(String purchaseOrderId) {
        PurchaseOrder purchaseOrders = baseMapper.selectDetails(purchaseOrderId);
        return purchaseOrders;
    }

    @Override
    public int updateState(String purchaseOrderId) {
        baseMapper.updateState(purchaseOrderId);
        return 0;
    }
}
